package com.danskin.wechat.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.danskin.wechat.dto.CustInfoDto;
import com.danskin.wechat.entity.CustCouponDetail;
import com.danskin.wechat.entity.CustInfo;
import com.danskin.wechat.entity.example.CustInfoExample;
import com.danskin.wechat.util.Page;
import com.danskin.wechat.vo.CustInfoVo;

public interface CustInfoDao {

	/**
	 * 根据主键获取用户信息
	 * 
	 * @param id
	 * @return
	 * @author makunsmac
	 */
	CustInfo selectByPrimaryKey(Integer id);
	
	/**
	 * 查询符合条件的用户信息
	 * @param param
	 * @return
	 * @author makunsmac
	 */
	List<CustInfo> selectCustInfoByExample(CustInfo param);
	
	/**
	 * 查询符合条件的用户数
	 * @param param
	 * @return
	 * @author makunsmac
	 */
	Integer selectCountByExample(CustInfo param);
	
	/**
	 * 根据用户手机号和mpId查询用户custExId
	 * @param mobile
	 * @param mpId
	 * @return
	 * @author makunsmac
	 */
	List<CustInfoDto> selectCustExIdByMobileAndOpenIdAndMpId(@Param("mobile") String mobile, @Param("openId") String openId, @Param("mpId") Integer mpId);
 
	public List<CustInfo> listPageCustInfoList(Page page);

	public List<CustCouponDetail> getCustCouponDetailList(CustCouponDetail custCouponDetail);

	/**
	 * 新建用户
	 * @param record
	 * @return
	 * @author makunsmac
	 */
	int insertSelective(CustInfo param);

	int updateByPrimaryKeySelective(CustInfo record);

	Map<String, Object> queryByOpenId(String id);

	/**
	 * 根据用户微信OpenId查询用户信息
	 * 
	 * @param wxOpenId
	 * @return
	 * @author makunsmac
	 */
	CustInfoVo queryCustInfoDtoByOpenId(@Param("wxOpenId") String wxOpenId);

	int updateByExampleSelective(@Param("record") CustInfo record, @Param("example") CustInfoExample example);

	List<CustInfo> selectByExample(CustInfoExample example);

	//CustInfo selectByMemberIdAndMobile(@Param("memberId") String memberId, @Param("mobile") String mobile);

	CustInfo selectByMemberId(@Param("memberId") String memberId);

	CustInfo getCustInfoMobile(@Param("openId")String openId);

	List<CustInfo> getCustInfoListExport(@Param("name")String name, @Param("mobile")String mobile, @Param("subscribe")String subscribe, @Param("startTime")String startTime,
			@Param("endTime")String endTime,@Param("mpId")String mpId);
	
	
}
